<div class="dux-page-header uk-clearfix">
    <div class="page-title">
        <a class="uk-button uk-button-primary" href="{url('index')}"> 用户列表</a>
    </div>
    <div class="page-action">
        <a class="uk-button uk-button-danger" href="javascript:location.reload();"><i class="fa fa-refresh"></i></a>
    </div>
</div>
<div class="uk-margin-top">
    <div class="uk-card uk-card-small uk-card-default dux-panel">
        <div class="uk-card-header">{$assignName}用户</div>
        <div class="uk-card-body">
            <form class="dux-form uk-form  uk-form-horizontal" data-dux="form-bind" method="post">
                <fieldset>
                    <div class="uk-form-group">
                        <label class="uk-form-label">推广等级</label>
                        <div class="uk-form-controls">
                            <select name="role_id" class="uk-form-field" data-dux="form-select" required>
                                <!--loop{$levelList as $vo}-->
                                <option value="{$vo.level_id}"
                                <!--if{ $vo['level_id'] == $info['level_id'] }--> selected <!--{/if}-->
                                >{$vo.name}</option>
                                <!--{/loop}-->
                            </select>
                        </div>
                    </div>
                    <div class="uk-form-group">
                        <label class="uk-form-label">用户</label>
                        <div class="uk-form-controls uk-form-controls-text">
                            {$info.show_name}

                        </div>
                    </div>
                    <div class="uk-form-group">
                        <label class="uk-form-label">上级用户</label>
                        <div class="uk-form-controls">
                            <div class="uk-input-group">
                                <span class="uk-input-group-label" id="user_show">
                                    {$info.parent_id ? $info.parent_name : '输入搜索'}
                                 </span>
                                <input type="hidden" name="parent_id" id="parent_id" value="{$info.parent_id}">
                                <input type="text" class="uk-form-field" id="user_keyword" value="" placeholder="ID/手机号/邮箱">
                                <span class="uk-input-group-btn">
                                    <button class="uk-button uk-button-default" type="button" id="search"><i
                                            class="fa fa-search"></i></button>
                                    <button class="uk-button uk-button-danger" type="button" id="remove"><i
                                            class="fa fa-trash"></i></button>
                                </span>
                            </div>

                        </div>
                    </div>
                    <div class="uk-form-group">
                        <div class="uk-form-controls">
                            <input type="hidden" name="user_id" value="{$info.user_id}">
                            <input type="hidden" name="id" value="{$info.id}">
                            <button class="uk-button uk-button-primary" type="submit" disabled>保存</button>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>

<script>
    Do('base', function () {
        $('#search').click(function () {
            var keyword = $('#user_keyword').val();
            app.ajax({
                url: '{url("sale/User/search")}',
                data : {keyword : keyword},
                success : function (info) {
                    notify.success({
                        content : '查询用户成功！'
                    });
                    $('#user_show').text(info.show_name);
                    $("#parent_id").val(info.user_id);
                }
            });
        });
        $('#remove').click(function () {
            $('#parent_id').val('');
            $('#user_keyword').val('');
        });
    });
</script>